package com.derek.omeshopping.ui.mine.presenter;/**
 * Created by ThinkPad on 2016/10/18.
 */

import com.derek.omeshopping.base.IView;
import com.derek.omeshopping.ui.mine.RegistContract;

import rx.Subscriber;

/**
 * 作者：ThinkPad on 2016/10/18 19:32
 * 邮箱：212740182@qq.com
 */
public class RegistPresenter implements RegistContract.Presenter {
    private RegistContract.View view;
    private RegistContract.Model model;

    public RegistPresenter(RegistContract.View view, RegistContract.Model model) {
        this.view = view;
        this.model = model;

    }

    @Override
    public void getData(String name, String pwd) {
        model.addData(name, pwd, new Subscriber<String>() {

            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable e) {
                view.registFailed("注册失败" + e.getMessage());
            }

            @Override
            public void onNext(String s) {
                view.registSuccess(s);

            }
        });
    }

    public void detachView() {
    }

    public void attachView(IView view) {
    }
}
